//***********************************************************************
//	File:		ConcussionBlast.cpp
//	Author:		
//	Course:		SGP 1405
//	Purpose:	
//***********************************************************************
//***********************************************************************
//	Purposfully left blank for all comments regarding this file 
//	
//	
//	
//***********************************************************************



#include "ConcussionBlast.h"
#include "../SGD Wrappers/SGD_Geometry.h"
#include "../SGD Wrappers/SGD_Event.h"

#include "../Message/DestroyEntityMessage.h"


ConcussionBlast::ConcussionBlast ( float posX , float posY , Entity* owner )
{
	SetEffectRadius ( 150 );
	SetForce ( 125.0f );
	//SetImage();
	SetLifespan ( 0.05f );
	SetLifespanTimer ( 0 );
	//SetParticleEffect();
	SetPosition ( SGD::Point { posX , posY } );
	SetRotation ( owner->GetRotation () );
	SetSize ( SGD::Size { 0 , 0 } );
	SetVelocity ( SGD::Vector { 0 , -1 } );
}

void ConcussionBlast::Update ( float dt )
{
	SGD::Event* pKnockback = new SGD::Event("CONCUSSION_BLAST", nullptr, this);
	pKnockback->SendEventNow();

	SetLifespanTimer(GetLifeSpanTimer() + dt); 
	if (GetLifeSpanTimer() > GetLifeSpan())
	{	
		DestroyEntityMessage* pEntityToDestroy = new DestroyEntityMessage(this); 
		pEntityToDestroy->QueueMessage(); 
	}

	//End of function
	Entity::Update ( dt );
}

void ConcussionBlast::Render ()
{

}

void ConcussionBlast::HandleCollision ( const IEntity* pOther )
{

}

void ConcussionBlast::HandleEvent ()
{

}

SGD::Rectangle ConcussionBlast::GetRect () const
{
	return SGD::Rectangle
	{
		GetPosition () - GetSize () / 2 ,
		GetPosition () + GetSize () / 2
	};
}

